Power Apps Portal Web API

| Muhammad Yaseen

Portals Web API are used to perform CUD (Create, Update, Delete) Operation, and for Reading purpose we have a FetchXml which works fine, Before Web API we need to rely only on provided standard functionality - forms (entity and web) on creating/updating records, entity lists on showing lists of records. And this was limiting especially from a user experience perspective. With the introduction of Portal Web API, we can create complex custom experiences - creative forms, editable lists and much more.

Security

Web API and Site Settings

By default, Web API on the portal is disabled. To enable it you need to configure it support per entity as a site setting.

Webapi/ENTITY NAME/enabled

Furthermore, you need to specify which fields will be available for web API as another site setting.

Webapi/ENTITY NAME/fields

Both these options give you more control over the security of your data (unlike odata entity list option).

Also, you can enable the ability to see inner Web API error with the next setting

Webapi/error/innererror

For example we want to enable Web API for contact entity for first name, last name and email address. Our setting will look like this:

Power Apps Portal API

To perform any action you will need to send a request to correct URL (api + entityset name), simple example will be if you want to create contact you will send POST request with json payload to next url YOUR_PORTAL_URL/_api/contacts.

Microsoft also provides the convenient Ajax wrapper function which you just have to use in portal pages. Portals Web API write, update, and delete operations - Power Apps | Microsoft Docs.

Power Apps Portal API

If you wants little more understading about this Wrapper Ajax function you can check below link,

Deep dive into Power Apps Portal Web API - Dancing with CRM

Example for update Method:

You simply have to use type patch and provide the entity name in URL with column unique identifier, I picked using liquid template functionality, and in json.stringyfy you have to provide the columns you wants to update with key value pair in Json format,

I also create its success and error function on which you can handle what you want to process after the successful or failed result

Power Apps Portal API

Microsoft also provide the CUD template for easiness.

Power Apps Portal API

Power Apps Portal API

Power Apps Portal API

Join us next time, as we continue our journey of learning canvas apps.Click here to learn more about Imperium's Power Apps Services. We hope this information was useful, and we look forward to sharing more insights into the Power Platform world.


M
Chief Architect, Founder, and CEO - a Microsoft recognized Power Platform solution architect.

About The Blog

Stay updated with what is happening in the Microsoft Business Applications world and initiatives Imperium is taking to ease digital transformation for customers.


More About Us

We provide guidance and strategic oversight to C-Suite and IT Directors for on-going implementations. Feel free to give us a call.

1 331 250 27 17
Send A Message

Ready to Start?

Get a personalized consultation for your project.

Book a Meeting